//
//  CollectviewChooseCell.m
//  Driver
//
//  Created by 大橙子 on 2018/11/7.
//  Copyright © 2018 Tomous. All rights reserved.
//

#import "CollectviewChooseCell.h"
#define SelectNum_ItemHeight 51
#define SelectNum_ItemWidth 77
#define ItemFont1 17
#define ItemFont2 16
@implementation CollectviewChooseCell
-(id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self initView];
    }
    return  self;
}


-(void)initView{
    _SelectIconBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    _SelectIconBtn.userInteractionEnabled = NO;
    [_SelectIconBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    [_SelectIconBtn setImage:[UIImage imageNamed:@"choose"] forState:UIControlStateNormal];
    [_SelectIconBtn setImage:[UIImage imageNamed:@"choose-selected"] forState:UIControlStateSelected];
    [self.contentView addSubview:_SelectIconBtn];

    
    
    _titleLab = [[UILabel alloc]init];
    _titleLab.textColor = [UIColor darkTextColor];
    _titleLab.font = [UIFont systemFontOfSize:16];
    _titleLab.textAlignment = NSTextAlignmentLeft;
    _titleLab.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:_titleLab];

}
-(void)layoutSubviews
{
    [super layoutSubviews];

    _SelectIconBtn.frame = CGRectMake(5, (self.height - 20)/2, 20, 20);
    _titleLab.frame = CGRectMake(_SelectIconBtn.right+5, 0, self.width - _SelectIconBtn.width - 10, self.height);

}
-(void)setModel:(DCCarrierModel *)model
{
    _model = model;
    _titleLab.text = model.carrierName;
}
-(void)UpdateCellWithState:(BOOL)select{
    self.SelectIconBtn.selected = select;
    _isSelected = select;
}
@end
